<template>
  <slot name="condition" v-if="isArrowUp"></slot>
  <slot name="btnsubmit"></slot>
  <div v-if="!$slots.btnsubmit"></div>
  <div :class="{same_row:isSameRow}" style="float: right;padding-right: 1rem" @click="handleSwitch">
    <el-button link>
      <span style="margin: 0 10px;">{{ isArrowUp ? '收起' : '更多条件' }}</span>
      <el-icon v-if="isArrowUp">
        <ArrowUp/>
      </el-icon>
      <el-icon v-else>
        <ArrowDown/>
      </el-icon>
    </el-button>
  </div>
  <div style="display: inline-flex;"></div>
</template>

<script>
import {defineComponent} from 'vue'

export default defineComponent({
  name: "index",
  props: {
    isSameRow: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      isArrowUp: false
    }
  },
  methods: {
    handleSwitch() {
      this.isArrowUp = !this.isArrowUp
      this.$emit('initParams', this.isArrowUp)
    }
  }
})
</script>

<style scoped lang="scss">
.same_row {
  display: contents;
}
</style>
